package duck.factory;

import duck.QuackCounterable;
import duck.Quackable;

public class CounterableDuckFactory extends DuckFactory {
	
	//TODO <?>
	//TODO try - catch
	@Override
	protected Quackable getDuck(Class<?> duckClass) { //throws InstantiationException, IllegalAccessException {
		try {
			return new QuackCounterable( (Quackable) duckClass.newInstance() );
		} catch (Exception e) {
			System.out.println("DuckFactory > getDuck > somthing was wrong with instantiating classes..");
			System.out.println(e);
			e.printStackTrace();
			return null;
		}
	}
}
